<?
  $combatspells = DB_GetList('SELECT * FROM '.getTableName('character_spells').' 
    LEFT JOIN '.getTableName('spells').' ON (sp_key = cs_spell)
    WHERE cs_character="'.$this->character->charDS['c_key'].'"
    AND sp_type="immediate" 
    ORDER BY sp_level,sp_name');
  if (sizeof($combatspells)>0)
  {
?>
  <div class="game_spellbox" <?= toolTip('combatspell.select') ?>>
    Prepare a combat spell:
    <select style="width: 100%" id="selectSpell" 
      onchange="sendAjaxRequest('<?= actionUrl('ajax_selectspell', 'game', 'spell=') ?>'+document.getElementById('selectSpell').options[document.getElementById('selectSpell').selectedIndex].value)">
      <option value="0">(select one)</option>
    <?
    foreach($combatspells as $spell)
    {
      ?><option <?
        if ($this->character->stats['spell.prepared'] == $spell['sp_key']) print('selected');
      ?> value="<?= $spell['sp_key'] ?>"><?= $spell['sp_name'].', '.$spell['sp_level'].' MP' ?></option><?
    }
    ?>
    </select>
  </div>
<?
  }
?>